<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import financialCostOrderDetail from '@/api/financial/financialCostOrderDetail'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'

const crudRef = ref()


const numberOperation = (newValue, id, numberName) => {
  financialCostOrderDetail.numberOperation({ id, numberName, numberValue: newValue }).then( res => {
    res.success && Message.success(res.message)
  }).catch( e => { console.log(e) } )
}

const switchStatus = (statusValue, id, statusName) => {
  financialCostOrderDetail.changeStatus({ id, statusName, statusValue }).then( res => {
    res.success && Message.success(res.message)
  }).catch( e => { console.log(e) } )
}


const options = reactive({
  id: 'flyos_financial_cost_order_detail',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  operationColumn: true,
  operationWidth: 160,
  formOption: {
    viewType: 'modal',
    width: 600
  },
  api: financialCostOrderDetail.getList,
  recycleApi: financialCostOrderDetail.getRecycleList,
  add: {
    show: true,
    api: financialCostOrderDetail.save,
    auth: ['financial:costOrderDetail:save']
  },
  edit: {
    show: true,
    api: financialCostOrderDetail.update,
    auth: ['financial:costOrderDetail:update']
  },
  delete: {
    show: true,
    api: financialCostOrderDetail.deletes,
    auth: ['financial:costOrderDetail:delete'],
    realApi: financialCostOrderDetail.realDeletes,
    realAuth: ['financial:costOrderDetail:realDeletes']
  },
  recovery: {
    show: true,
    api: financialCostOrderDetail.recoverys,
    auth: ['financial:costOrderDetail:recovery']
  },
  import: {
    show: true,
    url: 'financial/costOrderDetail/import',
    templateUrl: 'financial/costOrderDetail/downloadTemplate',
    auth: ['financial:costOrderDetail:import']
  },
  export: {
    show: true,
    url: 'financial/costOrderDetail/export',
    auth: ['financial:costOrderDetail:export']
  }
})

const columns = reactive([
  {
    title: "",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入"
    }
  },
  {
    title: "费用类型",
    dataIndex: "price_type",
    formType: "input",
    search: true
  },
  {
    title: "发货id",
    dataIndex: "send_id",
    formType: "input",
    search: true
  },
  {
    title: "预报单号",
    dataIndex: "prediction_id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "支付订单号",
    dataIndex: "pay_order_id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "成本单ID",
    dataIndex: "cost_order_id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "提单号",
    dataIndex: "order_id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "提单明细号",
    dataIndex: "order_detail_id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "装车单号",
    dataIndex: "driver_order_id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "计费车号",
    dataIndex: "car_no",
    formType: "input",
    search: true
  },
  {
    title: "箱号",
    dataIndex: "box",
    formType: "input",
    search: true
  },
  {
    title: "计算规则",
    dataIndex: "price_role",
    formType: "input",
    search: true
  },
  {
    title: "中文计费规则",
    dataIndex: "chi_price_role",
    formType: "input",
    search: true
  },
  {
    title: "税额",
    dataIndex: "tax_price",
    formType: "input",
    search: true
  },
  {
    title: "不含税价",
    dataIndex: "no_tax_price",
    formType: "input",
    search: true
  },
  {
    title: "金额",
    dataIndex: "pay_price",
    formType: "input",
    search: true
  },
  {
    title: "实际支付金额",
    dataIndex: "pay_real_price",
    formType: "input",
    search: true
  },
  {
    title: "优惠金额",
    dataIndex: "discount_price",
    formType: "input",
    search: true
  },
  {
    title: "费用名称",
    dataIndex: "pay_name",
    formType: "input",
    search: true
  },
  {
    title: "支付节点",
    dataIndex: "billing_node",
    formType: "input",
    search: true
  },
  {
    title: "部门id",
    dataIndex: "dept_id",
    formType: "input",
    search: true
  },
  {
    title: "批次号",
    dataIndex: "batch_no",
    formType: "input",
    search: true
  },
  {
    title: "品名类型id",
    dataIndex: "goods_type_id",
    formType: "input",
    search: true
  },
  {
    title: "计费重量",
    dataIndex: "weight",
    formType: "input",
    search: true
  },
  {
    title: "计费天数",
    dataIndex: "day",
    formType: "input",
    search: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "车辆比例",
    dataIndex: "car_no_value",
    formType: "input",
    search: true
  },
  {
    title: "是否已确认",
    dataIndex: "is_confirm",
    formType: "select",
    search: true,
    dict: {
      data: [
        {
          label: "待确认",
          value: "0"
        },
        {
          label: "已确认",
          value: "1"
        }
      ],
      translation: true
    }
  },
  {
    title: "支付部门ID",
    dataIndex: "pay_dept_id",
    formType: "input",
    search: true
  },
  {
    title: "小时",
    dataIndex: "hour",
    formType: "input",
    search: true
  },
  {
    title: "优化政策id",
    dataIndex: "zc_id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  }
])
</script>
<script> export default { name: 'financial:costOrderDetail' } </script>